package com.laf.mall.service.controller;

import com.laf.mall.service.dto.Member;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * @author ygl
 * @create 2018-12-17
 * @DESCRIPTION
 **/
@RestController
@RequestMapping("/member")
public class MemberController {

    /**
     * 获取可用积分
     * @param carNumber
     * @return
     */
    @GetMapping("/{carNumber}/points")
    public ResponseEntity findPoints(@PathVariable String carNumber) throws Exception {
        Member member = null;
        if (member == null) {
            return new ResponseEntity<>("info not foud",HttpStatus.INTERNAL_SERVER_ERROR);
        }

        return new ResponseEntity<Member>(member, HttpStatus.OK);
    }

    /**
     * 消费积分
     * @param carNumber
     * @return
     */
    @PostMapping("/{carNumber}/points")
    public ResponseEntity findPoints(@PathVariable String carNumber,@RequestParam("point") int point) throws Exception {
        Member member = null;
        if (member == null) {
            throw new Exception("ddddd");
        }

        return new ResponseEntity<Member>(member, HttpStatus.OK);
    }

}
